﻿<%@ Page Language="C#" AutoEventWireup="true"
    Inherits="SystemManage_GroupPermission" Codebehind="GroupPermission.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>

    <script type="text/javascript">
function client_OnTreeNodeChecked()
    {
        var obj = window.event.srcElement;
        var treeNodeFound = false;
        var checkedState;
        if (obj.tagName == "INPUT" && obj.type == "checkbox") 
        {
            var treeNode = obj;
            checkedState = treeNode.checked;
            do
            {
             obj = obj.parentElement;
            } 
         while (obj.tagName != "TABLE")
            var parentTreeLevel = obj.rows[0].cells.length;
            var parentTreeNode = obj.rows[0].cells[0];
            var tables = obj.parentElement.getElementsByTagName("TABLE");
            var numTables = tables.length
            if (numTables >= 1)
            {
                for (i=0; i < numTables; i++)
                {
                    if (tables[i] == obj)
                    {
                        treeNodeFound = true;
                        i++;
                        if (i == numTables)
                        {
                            return;
                        }
                    }
                    if (treeNodeFound == true)
                    {
                        var childTreeLevel = tables[i].rows[0].cells.length;
                        if (childTreeLevel > parentTreeLevel)
                        {
                            var cell = tables[i].rows[0].cells[childTreeLevel - 1];
                            var inputs = cell.getElementsByTagName("INPUT");
                            inputs[0].checked = checkedState;
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
        }
    }

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div align="Justify">
    <h2>用户组权限</h2>
     <div class="menu_bg"><asp:Button ID="Btn_save" CssClass="input_button" runat="server" Text="保 存" OnClick="Btn_save_Click" /></div>
     <div class="juli">
        <asp:TreeView ID="TreeView1" runat="server" NodeIndent="180" ShowCheckBoxes="All" onclick="client_OnTreeNodeChecked();"
                            ShowLines="True" Width="100%" Height="100%">
            <LeafNodeStyle ForeColor="Black" />
        </asp:TreeView></div>    
    </div>    
    </form>
</body>
</html>
